get username from active directory in C#.net [closed]

Posted by Jahangeer Ahmed on Server Fault See other posts from Server Fault or by Jahangeer Ahmed
Published on 2012-09-06T08:06:34Z Indexed on 2012/09/06 9:40 UTC
Read the original article Hit count: 192

Filed under:

get username from active directory in C#.net

ManagementObjectSearcher Usersearcher = new ManagementObjectSearcher("Select * From Win32_ComputerSystem"); ManagementObjectCollection Usercollection = Usersearcher.Get(); string[] sep = { "\" }; string[] UserNameDomain = Usercollection.Cast().First()["UserName"].ToString().Split(sep, StringSplitOptions.None); null reference exception

© Server Fault or respective owner

Related posts about active-directory